package iqq.ui.view.panel.login.proc;

import java.awt.Dimension;

import iqq.common.IQQConstants;
import iqq.util.ImageManager;
import iqq.util.LanguageLoader;

import com.alee.extended.image.WebImage;
import com.alee.extended.panel.BorderPanel;
import com.alee.extended.panel.CenterPanel;
import com.alee.extended.panel.GroupPanel;
import com.alee.extended.progress.WebProgressOverlay;
import com.alee.laf.button.WebButton;
import com.alee.laf.panel.WebPanel;
import com.alee.laf.progressbar.WebProgressBar;

/**
 * @author ChenZhiHui
 * @create-time 2013-3-10
 */
public class ProcCenterPl extends WebPanel {
	private static final long serialVersionUID = -2942445316873344635L;

	private WebImage logoImg;
	private WebProgressBar progressBar;
	private WebButton cancelBtn;
	private GroupPanel groupPl;

	public ProcCenterPl() {
		initComponent();
		addComponent();
	}

	private void addComponent() {
		add(groupPl);
	}

	private void initComponent() {
		logoImg = new WebImage(ImageManager.getImage(IQQConstants.ICON_DEF_QQ));

		progressBar = new WebProgressBar();
		progressBar.setIndeterminate(true);
		progressBar.setStringPainted(true);
		progressBar.setString("Please wait...");
		BorderPanel bp = new BorderPanel(progressBar);
		bp.setMargin(20, 0, 20, 0);

		cancelBtn = new WebButton(LanguageLoader.getString("cancel"));
		cancelBtn.setPreferredSize(new Dimension(80, 25));
		WebProgressOverlay progressOverlay = new WebProgressOverlay(cancelBtn);
		progressOverlay.setConsumeEvents(false);
		progressOverlay.setComponent(cancelBtn);
		progressOverlay.setShowLoad(true);

		groupPl = new GroupPanel(false, new BorderPanel(logoImg), bp,
				new CenterPanel(progressOverlay));
		groupPl.setMargin(50, 20, 50, 20);
	}
}
